home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TRUNCATE C Library Procedures TRUNCATE
-
-
-
- NNAAMMEE
- truncate, ftruncate - set a file to a specified length
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
-
- iinntt ttrruunnccaattee((ppaatthh,, lleennggtthh))
- cchhaarr **ppaatthh;;
- ooffff__tt lleennggtthh;;
-
- iinntt ffttrruunnccaattee((ffdd,, lleennggtthh))
- iinntt ffdd;;
- ooffff__tt lleennggtthh;;
-
- DDEESSCCRRIIPPTTIIOONN
- ttrruunnccaattee(()) causes the file referred to by _p_a_t_h (or for
- ffttrruunnccaattee(()) the object referred to by _f_d) to have a size
- equal to _l_e_n_g_t_h bytes. If the file was previously longer
- than _l_e_n_g_t_h, the extra bytes are removed from the file. If
- it was shorter, bytes between the old and new lengths are
- read as zeroes. With ffttrruunnccaattee(()), the file must be open for
- writing.
-
- RREETTUURRNN VVAALLUUEESS
- ttrruunnccaattee(()) returns:
-
- 0 on success.
-
- -1 on failure and sets eerrrrnnoo to indicate the error.
-
- EERRRROORRSS
- ttrruunnccaattee(()) may set eerrrrnnoo to:
-
- EACCES Search permission is denied for a com-
- ponent of the path prefix of _p_a_t_h.
-
- Write permission is denied for the file
- referred to by _p_a_t_h.
-
- EFAULT _p_a_t_h points outside the process's allo-
- cated address space.
-
- EIO An I/O error occurred while reading from
- or writing to the file system.
-
- EISDIR The file referred to by _p_a_t_h is a direc-
- tory.
-
- ELOOP Too many symbolic links were encountered
- in translating _p_a_t_h.
-
- ENAMETOOLONG The length of the path argument exceeds
-
-
-
- Sprite v1.0 21 January 1990 1
-
-
-
-
-
-
- TRUNCATE C Library Procedures TRUNCATE
-
-
-
- {PATH_MAX}.
-
- A pathname component is longer than
- {NAME_MAX} (see ssyyssccoonnff(2V)) while
- {_POSIX_NO_TRUNC} is in effect (see
- ppaatthhccoonnff(2V)).
-
- ENOENT The file referred to by _p_a_t_h does not
- exist.
-
- ENOTDIR A component of the path prefix of _p_a_t_h
- is not a directory.
-
- EROFS The file referred to by _p_a_t_h resides on
- a read-only file system.
-
- ffttrruunnccaattee(()) may set eerrrrnnoo to:
-
- EINVAL _f_d is not a valid descriptor of a file
- open for writing.
-
- _f_d refers to a socket, not to a file.
-
- EIO An I/O error occurred while reading from
- or writing to the file system.
-
- SSEEEE AALLSSOO
- ooppeenn(2V)
-
- BBUUGGSS
- These calls should be generalized to allow ranges of bytes
- in a file to be discarded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 21 January 1990 2
-
-
-
-